<?php

namespace frontend\models;

use Yii;

/**
 * This is the model class for table "cat".
 *
 * @property string $cat_id
 * @property string $catname
 * @property integer $num
 */
class Cat extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'cat';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['num'], 'integer'],
            [['catname'], 'string', 'max' => 30],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'cat_id' => 'Cat ID',
            'catname' => 'Catname',
            'num' => 'Num',
        ];
    }

    //获取所有分类
    public function getCatAll(){
        return $this->find()->asArray()->all();
    }



}
